<template>
  <div class="inset-0 m-auto w-full h-full flex flex-col">
    <span class="title text-[15px]" v-show="is_weixin() == true">Ai 页面</span>
    <span class="p-2  flex-col">
      <ToggleOn v-model="isToggleOn" :buttonTitle='buttonTitle' @sendstart="(val) => {
        setAiStatusSwitch({ ai_status: isToggleOn ? 1 : 0 })
      }" />
    </span>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import is_weixin from '../utils/judgment';
import { getAiStatusSwitch, setAiStatusSwitch } from '@/api';
import ToggleOn from '../components/isToggleOn/ToggleOn.vue';

const isToggleOn = ref(false)
const buttonTitle = '全局Ai 按钮：'

const event = {
  async getAiStatusSwitch() {
    const getAiSwith = await getAiStatusSwitch()
    isToggleOn.value = getAiSwith.ai_status == 1
  },
}

event.getAiStatusSwitch()
</script>

<style>
.title {
  height: 50px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #ededed;
}
</style>